package shiqi.excelListener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import shiqi.model.Demo;

import java.util.ArrayList;
import java.util.List;

/**
 * @author geo_tsg
 * @version 1.0.0
 * @ClassName DemoListener.java
 * @Description
 * @createTime 2022-04-20
 */
public class DemoListener extends AnalysisEventListener<Demo> {

    List<Demo> list = new ArrayList<>();

    public DemoListener() {
    }


    @Override
    public void invoke(Demo demo, AnalysisContext analysisContext) {
        list.add(demo);
        if (list.size() == 10) {
            System.out.println("保存");
        }
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        System.out.println("保存");
    }
}
